cmake_minimum_required(VERSION 3.10)
project(StatusServer LANGUAGES CXX)


set(PROJECT_NAME StatusServer)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#引入protobuf
find_package(protobuf CONFIG REQUIRED)

#引入gRPC
find_package(gRPC CONFIG REQUIRED)

#引入src下的源文件
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)

set(BOOST_ROOT /usr/local/hslDir/mylib/boost)
#引入boost库
find_package(Boost REQUIRED COMPONENTS system)

add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cc ${SOURCES})

#添加include目录
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/)

#链接gRPC库
target_link_libraries(${PROJECT_NAME} PRIVATE gRPC::grpc++ gRPC::grpc++_reflection protobuf::libprotobuf)
#连接protobuf
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)
#连接boost库
target_link_libraries(${PROJECT_NAME} PRIVATE Boost::system)


#引入Redis头文件
target_include_directories(${PROJECT_NAME} PRIVATE /usr/local/include/redis/)
#引入hiredis库
target_link_libraries(${PROJECT_NAME} PRIVATE /usr/local/lib/libhiredis.a)
